﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace Maticsoft.Common
{
    public class MsgHelper
    {
        public bool SendMsg(string mobile, string msgContent)
        {
            WebClient webClient = new WebClient();
            string username = "isaachome";
            string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("wangxin110", "MD5").ToLower();
            string strURL = "http://112.124.17.46:7001/sms_token?ddtkey=" + username + "&secretkey=" + pwd + "&mobile=" + mobile + "&content=" + msgContent + "&sendTime=";
            WebRequest wRequest = WebRequest.Create(strURL);
            WebResponse wResponse = wRequest.GetResponse();
            Stream stream = wResponse.GetResponseStream();
            StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
            string r = reader.ReadToEnd();
            wResponse.Close();
            return r.StartsWith("ok");
        }
    }
}
